package main

import (
	"github.com/golang-jwt/jwt/v4"
	"github.com/google/uuid"
)

const JWTSignKey = "rywyyds"

type MyCustomClaims struct {
	BaseClaims
	jwt.RegisteredClaims
}

type BaseClaims struct {
	UUID     uuid.UUID
	ID       uint
	Username string
}

type RywJwt struct {
	SignKey []byte
}

func (r *RywJwt) CreateToken(claims jwt.Claims) (string, error) {
	token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
	return token.SignedString(r.SignKey)
}
